package com.ruoyi.app.controller.score;

import com.ruoyi.app.business.score.ScoreBusiness;
import com.ruoyi.app.config.annotation.OperationAuth;
import com.ruoyi.app.config.annotation.ReSubmitFilter;
import com.ruoyi.app.domain.score.CompanyScore;
import com.ruoyi.app.domain.score.LaborScore;
import com.ruoyi.common.core.web.domain.APIResult;
import com.ruoyi.service.user.enums.UserTypeEnum;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 评价评分管理
 *
 * @author Zane
 * @since 2025-10-22 19:20
 */
@RestController
@RequestMapping("/score/")
public class ScoreController {

  @Resource
  private ScoreBusiness scoreBusiness;
//  /**
//   * 公司的评分 暂无展示
//   *
//   * @param projectId 项目Id
//   */
//  @RequestMapping("company/info")
//  public APIResult<Void> companyInfo(@RequestParam("projectId") String projectId) {
//    return APIResult.success();
//  }

  /**
   * 项目评价
   *
   */
  @OperationAuth({UserTypeEnum.LABOR_USER})
  @ReSubmitFilter
  @RequestMapping("company/rate")
  public APIResult<Void> companyRate(@Validated @RequestBody CompanyScore companyScore) {
    scoreBusiness.companyRate(companyScore);
    return APIResult.success();
  }

  /**
   * 评价项目成员[项目方]
   */
  @OperationAuth({UserTypeEnum.DEMANDER_USER})
  @RequestMapping("labor/rate/demander")
  public APIResult<Void> laborRateByDemander(@Validated @RequestBody LaborScore laborScore) {
    scoreBusiness.laborRateByDemander(laborScore);
    return APIResult.success();
  }

  /**
   * 评价项目成员[TL]
   */
  @OperationAuth({UserTypeEnum.LABOR_USER})
  @RequestMapping("labor/rate/tl")
  public APIResult<Void> laborRateByTl(@Validated @RequestBody LaborScore laborScore) {
    scoreBusiness.laborRateByTl(laborScore);
    return APIResult.success();
  }

}
